#ifndef YOLO_POST_PROCESS_H
#define YOLO_POST_PROCESS_H

#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <stdint.h>

namespace OHOS {
namespace AIS {
const int YOLOV7_OUTPUT_HW[3] = {80, 40, 20};
const int OBJ_CLASS_NUM = 80;
const int PROP_BOX_SIZE = 5 + OBJ_CLASS_NUM;
const float CONF_THRESHOLD = 0.25;
const float NMS_THRESHOLD = 0.45;

static std::vector<std::string> CALSS_NAME = {{"person"}, {"bicycle"}, {"car"}, {"motorcycle"}, {"airplane"},
                                {"bus"}, {"train"}, {"truck"}, {"boat"}, {"traffic light"},
                                {"fire hydrant"}, {"stop sign"}, {"parking meter"}, {"bench"}, {"bird"},
                                {"cat"}, {"dog"}, {"horse"}, {"sheep"}, {"cow"},
                                {"elephant"}, {"bear"}, {"zebra"}, {"giraffe"}, {"backpack"},
                                {"umbrella"}, {"handbag"}, {"tie"}, {"suitcase"}, {"frisbee"},
                                {"skis"}, {"snowboard"}, {"sports ball"}, {"kite"}, {"baseball bat"},
                                {"baseball glove"}, {"skateboard"}, {"surfboard"}, {"tennis racket"}, {"bottle"},
                                {"wine glass"}, {"cup"}, {"fork"}, {"knife"}, {"spoon"},
                                {"bowl"}, {"banana"}, {"apple"}, {"sandwich"}, {"orange"},
                                {"broccoli"}, {"carrot"}, {"hot dog"}, {"pizza"}, {"donut"},
                                {"cake"}, {"chair"}, {"couch"}, {"potted plant"}, {"bed"},
                                {"dining table"}, {"toilet"}, {"tv"}, {"laptop"}, {"mouse"},
                                {"remote"}, {"keyboard"}, {"cell phone"}, {"microwave"}, {"oven"},
                                {"toaster"}, {"sink"}, {"refrigerator"}, {"book"}, {"clock"},
                                {"vase"}, {"scissors"}, {"teddy bear"}, {"hair drier"}, {"toothbrush"}};

const int ANCHOR[3][6] = {  {12, 16, 19, 36, 40, 28},
                            {36, 75, 76, 55, 72, 146},
                            {142, 110, 192, 243, 459, 401}};

const float SCALE[3] = {0.003917, 0.003922, 0.003922};

const int ZP[3] = {-128, -128, -128}; 

int NMS(int validCount, std::vector<float> &outputLocations, std::vector<int> classIds, std::vector<int> &order, int filterId, float threshold);

int QuickSortIndiceInverse(std::vector<float> &input, int left, int right, std::vector<int> &indices);

int ProcessFP32(float *input, int *anchor, int grid_h, int grid_w, int stride, std::vector<float> &boxes, 
                    std::vector<float> &objProbs, std::vector<int> &classId, float threshold);

int ProcessInt8(int8_t *input, int *anchor, int grid_h, int grid_w, int stride, std::vector<float> &boxes, 
                std::vector<float> &objProbs, std::vector<int> &classId, float threshold, int32_t zp, float scale);
} // namespace AIS
} // namespace OHOS

#endif // YOLO_POST_PROCESS_H